<template>
  <!-- 顶部 -->
  <div class="top">
    <van-nav-bar
      title="绑定驾驶证"
      left-text="返回"
      right-text="首页"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <div>
      <van-field
        v-model="applyDate"
        label="申领日期"
        placeholder="2021-11-11"
      />
      <van-field v-model="verifyDate" label="有效期" placeholder="2021-11-11" />
      <!-- 输入任意文本 -->
      <van-field v-model="auditOffice" label="发证机关" />
      <!-- 输入手机号，调起手机号键盘 -->
      <van-field v-model="contact" type="tel" label="手机号" />
      <!-- 允许输入正整数，调起纯数字键盘 -->
      <van-field v-model="fileNo" type="digit" label="档案编号" />
      <!-- 允许输入数字，调起带符号的纯数字键盘 -->
      <van-field v-model="idCard" type="number" label="身份证号" />
      <van-field v-model="licenseLevel" label="准驾车型" />
      <van-field v-model="licenseNo" type="digit" label="驾驶证号" />
    </div>
    <van-button type="info" @click="getdetail">确认绑定</van-button>
  </div>
</template>

<script>
// import { Toast } from "vant";

import {addlicense} from "@/service/traffic/traffic"
import nav from "../../../mixin/nav";
export default {
  mixins: [nav],
  data() {
    return {
      //日期
      applyDate:'',
      verifyDate:"",
      //发证机关
      auditOffice: "",
      //联系方式
      contact: "",
      //档案编号
      fileNo: "",
      //身份证号
      idCard: "",
      //准驾车型
      licenseLevel: "",
      //驾驶证号
      licenseNo: "",
    };
  },
  methods: {
     async getdetail(val) {
            
           console.log(val);
            let { data } = await addlicense({
                applyDate: this.applyDate,
                verifyDate: this.verifyDate,
                auditOffice: this.auditOffice,
                contact: this.contact,
                fileNo: this.fileNo,
                idCard: this.idCard,
                licenseLevel: this.licenseLevel,
                licenseNo: this.licenseNo,

               
              
            })
            console.log(data);
            if (data.code == 200) {
                this.$toast.success("绑定成功!");
                this.$router.push("/traffic");
            } else {
                alert("请输入正确的格式")
               

            }
        },
    //头部方法
    onClickLeft() {
      this.$router.go(-1);
    },
    onClickRight() {
      this.$router.push("/");
    },
    
    },
  
};
</script>

<style>
</style>